[C# .NET6] AutoFac ADD implementation after DI Container Resolve


If you want to Add a implementation after DI Container resolved already,
you need to create a newBuilder and Update it to the original Container.

                var newBuilder = new ContainerBuilder();
                newBuilder.Register(c =>  new Car {Seats = GetSeats().Split(',') }).As<ICar>();
                newBuilder.Update(OriginalDIContainer);
#C# #.net6 #.net






你可能感興趣的文章

[Week6] CSS 選取器:全域選擇器、:nth-child()

[Week6] CSS 選取器:全域選擇器、:nth-child()

MySQL入門

MySQL入門

預備修煉:開發團隊需要什麼?六項修煉如何幫助團隊?

預備修煉:開發團隊需要什麼?六項修煉如何幫助團隊?






留言討論